/**
 * Created by IntelliJ IDEA.
 * User: Tomek
 * Date: 24.06.12
 * Time: 19:17
 * To change this template use File | Settings | File Templates.
 */
package AS3 {
public class ReferenceTemperatures {
    public function ReferenceTemperatures() {
        init();
    }

    private var _CoolingIntensity:Number = new Number(0);
    private var heatingIntensityArray:Array = new Array(101);
    private var CoolingS:Array = new Array(101);
    private var ukTempRef:Array = new Array(13);    // Temp. dla UK - referencja ogrzewania
    private var singaporeTempRef:Array = new Array(13);  // Temp. dla Singapuru - referencja

    public function getUKTempRefForMonth(month:int):Number {
        return ukTempRef[month];
    }

    public function setTHRef(value:Array):void {
        ukTempRef = value;
    }

    public function getHeatingIntensityForTemp(temp:int):Number {
        return heatingIntensityArray[temp];
    }


    public function getCoolingSForTemp(temp:int):Number {
        return CoolingS[temp];
    }

    public function getCoolingSArray():Array {
        return CoolingS;
    }

    public function getSingaporeTempRef(month:int):Number {
        return singaporeTempRef[month];
    }

    private function init():void{

        var i:int;

        for (i = -50; i < -13; i++) {
            heatingIntensityArray[i] = 1710 - (i + 12) * 70;
        }

        heatingIntensityArray[-12] = 1710;
        heatingIntensityArray[-11] = 1640;
        heatingIntensityArray[-10] = 1570;
        heatingIntensityArray[-9] = 1500;
        heatingIntensityArray[-8] = 1430;
        heatingIntensityArray[-7] = 1370;
        heatingIntensityArray[-6] = 1310;
        heatingIntensityArray[-5] = 1250;
        heatingIntensityArray[-4] = 1190;
        heatingIntensityArray[-3] = 1130;
        heatingIntensityArray[-2] = 1070;
        heatingIntensityArray[-1] = 1010;
        heatingIntensityArray[0] = 950;
        heatingIntensityArray[1] = 890;
        heatingIntensityArray[2] = 840;
        heatingIntensityArray[3] = 790;
        heatingIntensityArray[4] = 740;
        heatingIntensityArray[5] = 690;
        heatingIntensityArray[6] = 640;
        heatingIntensityArray[7] = 590;
        heatingIntensityArray[8] = 540;
        heatingIntensityArray[9] = 490;
        heatingIntensityArray[10] = 440;
        heatingIntensityArray[11] = 390;
        heatingIntensityArray[12] = 340;
        heatingIntensityArray[13] = 290;
        heatingIntensityArray[14] = 240;
        heatingIntensityArray[15] = 190;
        heatingIntensityArray[16] = 140;
        heatingIntensityArray[17] = 100;
        heatingIntensityArray[18] = 70;
        heatingIntensityArray[19] = 50;
        heatingIntensityArray[20] = 41;
        heatingIntensityArray[21] = 25;
        heatingIntensityArray[22] = 17;
        heatingIntensityArray[23] = 11;
        heatingIntensityArray[24] = 3;
        heatingIntensityArray[25] = 2;
        heatingIntensityArray[26] = 1;

        for (i = 27; i < 50; i++) {
            heatingIntensityArray[i] = 0;
        }
        //	lblKliknij.text = HeatingS[-48].toString();
        for (i = -50; i <= 5; i++) {
            CoolingS[i] = 0;
        }

        CoolingS[ 6] = 1;
        CoolingS[ 7] = 2;
        CoolingS[ 8] = 4;
        CoolingS[ 9] = 6;
        CoolingS[10] = 9;
        CoolingS[11] = 12;
        CoolingS[12] = 17;
        CoolingS[13] = 24;
        CoolingS[14] = 34;
        CoolingS[15] = 47;
        CoolingS[16] = 65;
        CoolingS[17] = 85;
        CoolingS[18] = 110;
        CoolingS[19] = 140;
        CoolingS[20] = 170;
        CoolingS[21] = 210;
        CoolingS[22] = 255;
        CoolingS[23] = 300;
        CoolingS[24] = 345;
        CoolingS[25] = 390;
        CoolingS[26] = 435;
        CoolingS[27] = 480;
        CoolingS[28] = 525;
        CoolingS[29] = 570;
        CoolingS[30] = 615;
        CoolingS[31] = 660;
        for (i = 32; i < 51; i++) {
            CoolingS[i] = 660 + (i - 31) * 50;
        }

        // Temp. dla UK - referencja ogrzewania
        ukTempRef[1] = 3;
        ukTempRef[2] = 3;
        ukTempRef[3] = 6;
        ukTempRef[4] = 7;
        ukTempRef[5] = 11;
        ukTempRef[6] = 14;
        ukTempRef[7] = 16;
        ukTempRef[8] = 16;
        ukTempRef[9] = 13;
        ukTempRef[10] = 10;
        ukTempRef[11] = 6;
        ukTempRef[12] = 5;
// Temp. dla Singapuru - referencja
        singaporeTempRef[1] = 27;
        singaporeTempRef[2] = 27;
        singaporeTempRef[3] = 28;
        singaporeTempRef[4] = 28;
        singaporeTempRef[5] = 28;
        singaporeTempRef[6] = 28;
        singaporeTempRef[7] = 28;
        singaporeTempRef[8] = 28;
        singaporeTempRef[9] = 27;
        singaporeTempRef[10] = 27;
        singaporeTempRef[11] = 27;
        singaporeTempRef[12] = 26;
    }
}
}
